Monotonic counter

ABSTRACT

A monotonic counter stores N binary words representing a value in N memory cells. When i memory cells of consecutive ranks between k modulo N and k+i modulo N each represent a value complementary to a null value, the counter is incremented by erasing a value of a memory cell of rank k+i+1 modulo N. When i+1 memory cells of consecutive ranks between k+1 modulo N and k+i+1 modulo N each represent the value complementary to the null value, the counter is incremented by incrementing a value of a memory cell of rank k modulo N by two step sizes and storing a result in a memory cell of rank k+1 modulo N, wherein, N is an integer greater than or equal to five, k is an integer, and i is an integer between 2 and N−3.

BACKGROUND Technical Field

The present disclosure relates generally to electronic systems anddevices implementing a counter. More particularly, the presentdescription relates to the implementation of a monotonic counter.

Description of the Related Art

A counter is a hardware and/or software entity, able to count countableelements and/or measure quantities. A counter successively performsoperations of adding a step to the value it shows.

A counter may be implemented by various electronic devices and systems.As an example, a counter can be implemented by a processor storing thevalue of the counter in a cell of a memory. The counter values may beused, for example, to track a number of uses or a duration of use of anapplication program, a circuit or a medium, to facilitate cryptographicoperations, etc.

A monotonic counter is a counter whose value is strictly increasing (ordecreasing) as additions are made.

BRIEF SUMMARY

In an embodiment, a device comprises: a non-volatile memory, which, inoperation, stores a number N of binary words in N memory cells of thenon-volatile memory, the N binary words representing a value of amonotonic counter, each binary word having a size sufficient to store amaximum value of the monotonic counter; and control circuitry coupled tothe memory, wherein the control circuitry, in operation, increments thevalue of the monotonic counter by a step size, the incrementing thevalue of the monotonic counter by the step size including: in responseto i memory cells of the N memory cells of consecutive ranks between kmodulo N and k+i modulo N each representing a value complementary to anull value, erasing a value of a memory cell of the N memory cells ofrank k+i+1 modulo N; and in response to i+1 memory cells of the N memorycells of consecutive ranks between k+1 modulo N and k+i+1 modulo N eachrepresenting the value complementary to the null value, incrementing avalue of a memory cell of the N memory cells of rank k modulo N by twostep sizes and storing a result of the incrementing of the value of thememory cell of rank k modulo N by two step sizes in a memory cell of theN memory cells of rank k+1 modulo N, wherein, N is an integer greaterthan or equal to five, k is an integer, and i is an integer between 2and N−3.

In an embodiment, a method, comprises: storing a number N of binarywords in N memory cells of a non-volatile memory, the N binary wordsrepresenting a value of a monotonic counter, each binary word having asize sufficient to store a maximum value of the monotonic counter; andincrementing the value of the monotonic counter by a step size. Theincrementing the value of the monotonic counter by the step sizeincludes: in response to i memory cells of the N memory cells ofconsecutive ranks between k modulo N and k+i modulo N each representinga value complementary to a null value, erasing a value of a memory cellof the N memory cells of rank k+i+1 modulo N; and in response to i+1memory cells of the N memory cells of consecutive ranks between k+1modulo N and k+i+1 modulo N each representing the value complementary tothe null value, incrementing a value of a memory cell of the N memorycells of rank k modulo N by two step sizes and storing a result of theincrementing of the value of the memory cell of rank k modulo N by twostep sizes in a memory cell of the N memory cells of rank k+1 modulo N,wherein, N is an integer greater than or equal to five, k is an integer,and i is an integer between 2 and N−3.

In an embodiment, a system comprises: a processor, which, in operation,processes data; and a monotonic counter coupled to the processor,wherein the monotonic counter, in operation: stores a number N of binarywords in N memory cells of a non-volatile memory, the N binary wordsrepresenting a value of a monotonic counter, each binary word having asize sufficient to store a maximum value of the monotonic counter; andresponds to an indication to increment the value of the monotoniccounter by a step size by: in response to i memory cells of the N memorycells of consecutive ranks between k modulo N and k+i modulo N eachrepresenting a value complementary to a null value, erasing a value of amemory cell of the N memory cells of rank k+i+1 modulo N; and inresponse to i+1 memory cells of the N memory cells of consecutive ranksbetween k+1 modulo N and k+i+1 modulo N each representing the valuecomplementary to the null value, incrementing a value of a memory cellof the N memory cells of rank k modulo N by two step sizes and storing aresult of the incrementing of the value of the memory cell of rank kmodulo N by two step sizes in a memory cell of the N memory cells ofrank k+1 modulo N, wherein, N is an integer greater than or equal tofive, k is an integer, and i is an integer between 2 and N−3.

In an embodiment, a non-transitory computer-readable medium's contentscause a monotonic counter to perform a method, the method comprising:storing a number N of binary words in N memory cells of a non-volatilememory, the N binary words representing a value of the monotoniccounter, each binary word having a size sufficient to store a maximumvalue of the monotonic counter; and incrementing the value of themonotonic counter by a step size, the incrementing the value of themonotonic counter by the step size including: in response to i memorycells of the N memory cells of consecutive ranks between k modulo N andk+i modulo N each representing a value complementary to a null value,erasing a value of a memory cell of the N memory cells of rank k+i+1modulo N; and in response to i+1 memory cells of the N memory cells ofconsecutive ranks between k+1 modulo N and k+i+1 modulo N eachrepresenting the value complementary to the null value, incrementing avalue of a memory cell of the N memory cells of rank k modulo N by twostep sizes and storing a result of the incrementing of the value of thememory cell of rank k modulo N by two step sizes in a memory cell of theN memory cells of rank k+1 modulo N, wherein, N is an integer greaterthan or equal to five, k is an integer, and i is an integer between 2and N−3.

BRIEF DESCRIPTION OF THE SEVERAL VIEWS OF THE DRAWINGS

The foregoing features and advantages, as well as others, will bedescribed in detail in the following description of specific embodimentsgiven by way of illustration and not limitation with reference to theaccompanying drawings, in which:

FIG. 1 represents, very schematically and in block form, an electronicdevice architecture.

FIG. 2 represents, very schematically and in block form, states of oneembodiment of a monotonic counter.

FIG. 3 represents, very schematically and in block form, a mode ofimplementation of steps for incrementing a state of the counter of FIG.2.

FIG. 4 represents, very schematically and in block form, a mode ofimplementation of steps for incrementing another state of the counter ofFIG. 2.

FIG. 5 represents, very schematically and in block form, a mode ofimplementation of steps of an initialization operation of a state of thecounter of FIG. 2.

FIG. 6 represents, very schematically and in block form, a mode ofimplementation of steps of an initialization operation of another stateof the counter of FIG. 2.

FIG. 7 represents, very schematically and in block form of, two viewsillustrating a mode of implementation of steps for stabilizing states ofthe counter of FIG. 2.

FIG. 8 represents, very schematically and in block form, two viewsillustrating a mode of implementation of steps for stabilizing otherstates of the counter of FIG. 2.

FIG. 9 represents, very schematically and in block form, two viewsillustrating a mode of implementation of steps for stabilizing anotherstate of the counter of FIG. 2.

FIG. 10 represents, very schematically and in block form, states ofanother embodiment of a monotonic counter.

DETAILED DESCRIPTION

Like features have been designated by like references in the variousfigures, unless the context indicates otherwise. In particular, thestructural and/or functional features that are common among the variousembodiments may have the same references and may dispose identical orsimilar structural, dimensional and material properties.

For the sake of clarity, only the operations and elements that areuseful for an understanding of the embodiments described herein havebeen illustrated and described in detail.

Unless indicated otherwise, when reference is made to two elementsconnected together, this signifies a direct connection without anyintermediate elements other than conductors, and when reference is madeto two elements coupled together, this signifies that these two elementscan be connected or they can be coupled via one or more other elements.

In the following disclosure, unless indicated otherwise, when referenceis made to absolute positional qualifiers, such as the terms “front,”“back,” “top,” “bottom,” “left,” “right,” etc., or to relativepositional qualifiers, such as the terms “above,” “below,” “higher,”“lower,” etc., or to qualifiers of orientation, such as “horizontal,”“vertical,” etc., reference is made to the orientation shown in thefigures.

Unless specified otherwise, the expressions “around,” “approximately,”“substantially” and “in the order of” signify within 10%, within 5%.

In the description, the value of a counter will be referred to as thevalue of the result of the last operation performed by that counter.

FIG. 1 is a block diagram representing, very schematically and in blockform, an example of the architecture of an electronic device 100 able toimplement a monotonic counter.

The electronic device 100 comprises a processor or circuit 101 (CPU)able to implement various processing of data stored in memories and/orprovided by other circuits of the device 100.

The electronic device 100 further comprises different types of memories,including a non-volatile memory 102 (NVM), a volatile memory 103 (RAM),and a read-only memory 104 (ROM). Each memory is able to store differenttypes of data. According to one variant, the electronic device 100 maynot comprise a read-only memory 104, whereby software implemented by thedevice may store its instructions and code only in the volatile memory103.

The electronic device 100 further comprises different circuits 105 (FCT)able to perform different functions. As an example, the circuits 105 maycomprise measurement circuits, data conversion circuits, cryptographiccircuits, etc.

The electronic device 100 may further comprise interface circuits 106(IO/OUT) able to send and/or receive data from outside the device 100.The interface circuits 106 may further be able to implement a datadisplay, for example a display screen.

The electronic device 100 further comprises one or more data buses 107able to transfer data between its various components. More particularly,the bus 107 is able to transfer data stored in the memories 102 to 104to the processor 101, the circuits 105, and the interface circuits 106.

FIG. 2 illustrates three states (A), (B), and (C) of one embodiment of amonotonic counter.

The monotonic counter of the present description is, for example,implemented by an electronic device of the type of the device 100described in relation to FIG. 1. More particularly, the value of themonotonic counter is stored in memory cells of the non-volatile memory102. According to one embodiment, the non-volatile memory 102 is a PhaseChange Memory (PCM), or an Electrically-Erasable Programmable Read-OnlyMemory (EEPROM). The storing and incrementing of the value of themonotonic counter in the memory cells may be controlled by controlcircuitry, such as control circuitry of the processor 101 or controlcircuitry of a functional circuit 105 or combinations thereof. Thestored value may be used, for example, by the processor 101 or thefunctional circuit 105 or combinations thereof.

The monotonic counter is, in the case described in relation to FIG. 2, acounter adding a fixed step p to its value at each operation. The stepis, for example, equal to one. In other words, at each new iteration thevalue of the counter is incremented by step p.

According to one embodiment, the monotonic counter is implemented usinga number N, where N is a natural number greater than or equal to five,of memory cells C(0) to C(N−1). The memory cells C(0) to C(N−1) are, forexample, memory cells of the non- volatile memory 102 of FIG. 1. Eachmemory cell C(0) to C(N−1) is able to store a binary word, for examplean octet. In the following, a memory cell is said to represent a valuewhen the said memory cell stores a binary word representing the saidvalue. Furthermore, each memory cell C(0) to C(N−1) is able to store abinary word whose size is large enough to represent a maximum value thatcan be reached by the monotonic counter. According to one example, thememory cells C(0) to C(N−1) have consecutive memory addresses in memory102. According to an alternative embodiment, the memory cells C(0) toC(N−1) do not have consecutive memory addresses in the memory 102.

In FIG. 2, and in FIGS. 3 to 10, the following symbols will be used torepresent certain special values of the memory cells C(0) to C(N−1):

-   -   the symbol “0” indicates that the null value has been written to        the memory cell;    -   the symbol “−” indicates that the value of the memory cell has        been erased, also called hereafter erased value “−,” the memory        cell represents then a complementary value to the null value        “0”; and    -   the symbol “#” indicates that any value, but different from the        value represented by the symbol “−,” has been written to the        memory cell.

According to one example, if a memory cell stores an octet, the nullvalue is the value zero (0), and the complementary value to the nullvalue is the value two hundred fifty-five (255) or the value FF inhexadecimal.

In addition, a memory cell C(j) may also be referred to as a memory cellC(j) of rank j modulo N, or of rank j, where j is an integer anddesignates the place of the memory cell within the N memory cells of themonotonic counter.

The state (A) of the monotonic counter is its initial state in which thevalue of the counter is equal to the zero value “0.” In state (A), allmemory cells C(0) to C(N−1) show any value “#” except:

-   -   a memory cell C(k) of rank k modulo N, k being a natural number,        which represents the null value “0”; and    -   two memory cells C(k+1) and C(k+2) whose ranks are successive to        the memory cell C(k), which have been erased and which therefore        show the value “−.”

State (B) of the monotonic counter is the state in which the value ofthe counter is a value V different from the zero value “0” and the value“−.” In state (B), all memory cells C(0) to C(N 1) represent any value“#” except:

-   -   a memory cell C(k), or memory cell C(k) of rank k modulo N,        which represents the value V.    -   a memory cell C(k−1) which represents the value V subtracted of        twice the step p of the counter; and    -   two memory cells C(k+1) and C(k+2) whose rank is successive to        the memory cell C(k), which have been erased and which therefore        represent the value “−.”

The state (C) of the monotonic counter is the state in which the countervalue is the value V incremented by the step p. In state (C) all memorycells C(0) to C(N−1) represent any value “#” except:

-   -   one memory cell C(k) of rank k modulo N which represents the        value V; and    -   three memory cells C(k+1), C(k+2), and C(k+3) whose rank is        successive to memory cell C(k), which have been erased and thus        represent the value “−.”

The two main states of the monotonic counter are states (B) and (C),state (A) being the special case of state (B) where the value V is thenull value “0.” An incrementing step of the monotonic counter allows topass from the state (B) to the state (C), or from the state (C) to thestate (B). An incrementing operation from the state (B) to state (C) isdescribed in relation to FIG. 3. An incrementing operation from state(C) to state (B) is described in relation to FIG. 4.

FIG. 3 represents, very schematically and in block form, a mode ofimplementation of the steps of an incrementing operation allowing themonotonic counter described in relation to FIG. 2 to pass from state (B)to state (C).

The states (A), (B) and (C) of the monotonic counter have been describedin relation to FIG. 2, the same references and notations are used hereto designate them.

For the record, the state (B) is characterized by a memory cell showingthe value V of the monotonic counter, followed by two consecutive memorycells showing the erased value “−,” and preceded by a memory cellshowing the value V subtracted by two times the counter step p. State(C) is characterized by a memory cell showing the V value followed bythree memory cells showing the erased value “−.”

The incrementing operation allowing to pass from the state (B) to state(C) is a step of erasing the first memory cell C(k+3), representing anyvalue “#,” and following the two memory cells C(k+1) and C(k+2)representing the value “−.” Once the memory cell C(k+3) is erased, thememory cell C(k) is followed by three erased memory cells, and we returnto the configuration of the state (C).

During the implementation of this incrementing operation, the memorycells C(0) to C(N−1) of the monotonic counter pass through differentstable states and unstable states. An unstable state is a state of amemory cell where the value it represents is unreliable. The stable orunstable character of a cell is deduced from the configuration of agroup of memory cells. According to one example, if a memory cellpresents a surprising value, then it can be considered unstable. InFIGS. 3 to 9, a memory cell with an unstable state is hatched. Thesequence of these states is described below. An example of a method forstabilizing these states is described next.

At the beginning of the incrementing operation, the counter is in thestable state (B). In other words, all memory cells C(0) to C(N−1) of thecounter show a reliable value.

Upon receiving the erase command for memory cell C(k+3), the counterpasses to a state (b1) similar to state (B) but in which the value ofmemory cell C(k+3) is unreliable. In this state (b1), memory cell C(k+3)still represents some value “#” but not reliably, so in FIG. 3, memorycell C(k+3) is hatched.

During implementation of the erase command for memory cell C(k+3), thecounter passes to a state (c1) similar to state (C) but in which thevalue of the memory cell C(k+3) is unreliable. In this state (c1), thememory cell C(k+3) represents the “−” value complementary to the nullvalue but not reliably, so in FIG. 3, the memory cell C(k+3) is stillhatched.

Once the erase operation is complete, the monotonic counter is in thestable (C) state, as described in relation to FIG. 2.

Occasionally, the monotonic counter may experience impromptu stopsduring the implementation of, for example, an increment operation. Whenthe counter is restarted, it may be in an unstable state. If the stateis unstable, then the monotonic counter implements a stabilizationmethod thus allowing to make the state stable.

The stabilization method implemented for a state of the type of state(b1) allows the return to a stable state (B). This method is as follows:

-   -   confirming the value of the memory cell C(k), by programming the        value it represents:    -   erasing the value of the memory cell C(k+2), so that it        represents the value “−” complementary to the null value “0”;        and    -   writing the null value “0” in the memory cell C(k+3).

The null value “0” written in the memory cell C(k+3) is processed, inthe further implementation of the monotonic counter, as any value “#.”According to one embodiment, any value “#” different from the null value“0” and the value “−” may be written into the memory cell C(k+3).

The stabilization method implemented for a state of the type of state(c1) allows it to return to a stable state (C). This method includessuccessively erasing the memory cells C(k+1), C(k+2) and C(k+3), so thatthey all represent the value “−” complementary to the null value “0.”

FIG. 4 represents, very schematically and in block form, a mode ofimplementation of steps of an incrementing operation allowing to passfrom the state (C) to the state (B) of the monotonic counter describedin relation to FIG. 2.

The stable states (A), (B) and (C) of the monotonic counter have beendescribed in relation to FIG. 2 and the unstable states (b1) and (c1)have been described in relation to FIG. 3, the same references andnotations are used here to refer to them.

In FIG. 4, the state (C) is characterized by a memory cell representingthe value V followed by three memory cells representing the erased value“−.” In the state (C), the monotonic counter then represents the value Vincremented by the step p (V+p). The state (B) is characterized by amemory cell showing the value V incremented by two times the step p(V+2p), followed by two consecutive memory cells representing the erasedvalue “−,” and preceded by a memory cell showing the value V subtractedby two times the step p of the counter. In the state (B), the countershows the value V+2p.

The incrementing operation to pass from the state (C) to state (B) is astep of writing the first memory cell C(k+1) of the three memory cellsC(k+1), C(k+2), and C(k+3) representing the “−” value of state (C). Moreprecisely, the value V of the cell C(k) incremented by twice the step p,noted then V+2p is written in the memory cell C(k+1). We then find theconfiguration of the state (B), the two memory cells C(k) and C(k+1)represent non-zero values and whose difference is equal to twice thestep p, and the memory cells C(k+2) and C(k+3) represent the erasedvalue “−” complementary to the zero value “0.”

As with the incrementing operation described in relation to FIG. 3,during the implementation of this incrementing operation, the memorycells C(0) to C(N−1) of the monotonic counter pass through differentstable states and unstable states. The succession of these states isdescribed below. An example method for stabilizing these states isdescribed next.

At the beginning of the increment operation, the counter is in thestable state (C). In other words, all memory cells C(0) to C(N−1) of thecounter represent a reliable value.

Upon receiving the write command from the memory cell C(k+3), thecounter passes to a state (c2) similar to state (C) but in which thevalue in the memory cell C(k+1) is unreliable. In this state (c2), thememory cell C(k+1) still represents the erased value “−” complementaryto the null value “0” but not reliably. Thus, in FIG. 4, state c2, thememory cell C(k+1) is hatched.

During implementation of the write command to memory cell C(k+1), thecounter passes to a state (d) similar to state (B) but in which thevalue of the memory cell C(k+1) no longer shows the erased value “−” anddoes not yet represent the value V+2p. In this state (d), the memorycell C(k+1) represents an erroneous value Err different from the value“−” and from the value V+2p which is unreliable. Thus, in FIG. 4, stated, the memory cell C(k+1) is hatched.

As the write operation is completed, the counter passes to a state (b2)similar to the state (B) but in which the value of memory cell C(k+1) isstill unreliable. In this state (b2), the memory cell C(k+1) representsthe value V+2p but not reliably. Thus, in FIG. 4, state b2, the memorycell C(k+1) is hatched.

Once the erase operation is completed, the monotonic counter is in thestable (B) state, such as that described in relation to FIG. 2.

As with the increment operation described in relation to FIG. 3, ifafter a restart the counter state is unstable, a stabilization methodallowing to make the state stable is implemented.

The stabilization method implemented for a state of the type of state(c2) is the same as that for the state (c1) described in relation toFIG. 3 and allows the return to a stable state (C). In other words, itis the successive erasure of the memory cells C(k+1), C(k+2) and C(k+3),so that they all represent the value “−” complementary to the null value“0.”

The stabilization method implemented for a state of the type of state(b2) is the same as that for the state (b1) described in relation toFIG. 3 and allows for a return to a stable state (B). In other words,this method includes the following steps:

-   -   confirming the value of the memory cell C(k+1), by programming        the value it represents:    -   erasing the value of memory cell C(k+3), so that it represents        the value “−” complementary to the null value “0”; and    -   writing the null value “0” to memory cell C(k+4).

The stabilization method implemented for a state of the type of state(d) includes rewriting the value of memory cell C(k+1), so that itrepresents the value V+2p and not the erroneous value Err.

An advantage of the incrementing operations described in relation toFIGS. 3 and 4 is that they allow minimizing the number of elementarywrite and erase operations of an incrementing operation. Indeed, in amonotonic counter whose value is written in a single memory cell, eachincrementing operation requires an elementary operation of erasing thevalue from the memory cell, then an elementary operation of writing theincremented value in the memory cell. The incrementing operations of thepresent embodiment allow the number of elementary operations to bedivided by two. Reducing the number of elementary operations allows toreduce the power consumption of the counter, to increase its executionspeed, and to improve its endurance. It is said that the more enduring acounter is, the greater the number of operations it can implement duringthe lifetime of the device executing it.

FIG. 5 represents, very schematically and in block form, a mode ofimplementation of the steps of an initialization operation of a state(C) allowing it to pass from the state (C) to state (A) of the monotoniccounter described in relation to FIG. 2.

The stable states (A), (B) and (C) of the monotonic counter have beendescribed in relation to FIG. 2 and the unstable states (b1), (b2),(c1), (c2), and (d) have been described in relation to FIGS. 3 and 4,the same references and notations are used here to designate them.

For the record, the state (A) is characterized by a memory cellrepresenting the zero value “0” of the monotonic counter, followed bytwo consecutive memory cells representing the erased value “−.” Thestate (C) is characterized by one memory cell representing the V valuefollowed by three memory cells representing the erased value “−.”

For a state (C) identical to the state (C) described in relation to FIG.2, the initialization operation of the state (C) comprises the followingsuccessive steps:

-   -   writing the null value “0” in the memory cell C(k+2).    -   writing the null value “0” in the memory cell C(k+1), this null        value “0” is equated to, in the continuation of the        implementation of the operation, as any value “#,” and thus a        variant here would be to write any value “#” in the memory cell        C(k+1); and    -   erasing the value in memory cell C(k+4), so that it shows the        erased value “−”.

As with the incrementing operations described in relation to FIGS. 3 and4, during the implementation of this initialization operation, thememory cells C(0) to C(N−1) of the monotonic counter pass throughvarious stable states and unstable states. The succession of thesestates is described below. Examples of the method for stabilizing thesestates are described in relation to FIGS. 7 and 8.

At the beginning of the initialization operation, the counter is in thestable state (C). That is, all memory cells C(0) to C(N−1) of thecounter show a reliable value.

During the step of writing the null value “0” to the memory cell C(k+2),the counter goes through a succession of three unstable states (c3),(e1) and (e2) where the value represented by memory cell C(k+2) isunreliable. In the state (c3), the memory cell C(k+2) still representsthe erased value “−” complementary to the null value “0.” In the state(e1), the memory cell C(k+2) represents the erroneous value Errdifferent from the value “−” and the null value “0.” In the state (e2),the memory cell C(k+2) already represents the null value “0.”

During the step of writing the null value “0” in the memory cell C(k+1),the counter passes through a succession of three unstable states (e3),(f1) and (f2) where the value shown by the memory cell C(k+1) isunreliable. In the state (e3), the memory cell C(k+1) still representsthe erased value “−” complementary to the null value “0.” In the state(f1), the memory cell C(k+1) represents the erroneous value Errdifferent from the value “−” and the null value “0.” In the state (f2),the memory cell C(k+1) already represents the null value “0.”

During the step of erasing the memory cell C(k+4), the counter goesthrough a succession of two states (f3), (a1) where the valuerepresented by the memory cell C(k+4) is unreliable. In the state (f3),the memory cell C(k+1) still represents any value “#.” In the state(a1), the memory cell C(k+4) already represents the deleted value “−.”

As with the incrementing operations described in relation to FIGS. 3 and4, if, after a restart, the counter state is unstable, a stabilizationmethod to make the state stable is implemented.

The method for stabilizing the state (c3) is the same as the method forstabilizing the states (c1) and (c2) described in connection with FIGS.3 and 4. In other words, it is the successive erasure of the memorycells C(k+1), C(k+2) and C(k+3), so that they all represent the value“−” complementary to the null value “0.”

The method for stabilizing states of the type of states (e1), (e2) and(e3) is common to these three states. This method is described in moredetail in relation to FIG. 7.

The method for stabilizing states of the type of states (f1), (f2) and(f3) is common to these three states. This method is described in moredetail in connection with FIG. 8.

The stabilization method implemented for a state of the type of state(a1) comprises erasing the memory cell C(k+4), so that it represents thevalue “−” complementary to the null value “0.”

FIG. 6 represents, very schematically and in block form, a mode ofimplementation of the steps of an initialization operation of the state(B) allowing it to pass from the state (B) to the state (A) of themonotonic counter described in relation to FIG. 2.

The stable states (A), (B) and (C) of the monotonic counter have beendescribed in relation to FIG. 2, the unstable states (b1), (b2), (c1) to(c3), (d), (e1) to (e3), and (f1) to (f3) have been described inrelation to FIGS. 3 to 5, and the same references and notations are usedherein to designate them.

For the record, state (B) is characterized by a memory cell representingthe value V of the monotonic counter, followed by two consecutive memorycells representing the erased value “−,” and preceded by a memory cellrepresenting the value V subtracted by two times the counter step p. Thestate (A) is characterized by a memory cell representing the zero value“0” of the monotonic counter, followed by two consecutive memory cellsrepresenting the erased value “−.”

For a state (B) identical to the state (B) described in relation to FIG.2, the initialization operation of the state (B) comprises the followingsuccessive steps:

-   -   writing the null value “0” in the memory cell C(k+2).    -   erasing the memory cell C(k+3).    -   writing the null value “0” in the memory cell C(k+1), this null        value “0” is equated to, in the continuation of the        implementation of the operation, as an unspecified value “#,”        and thus a variant here would be to write an unspecified value        “#” in the memory cell C(k+1); and    -   erasing the value of the memory cell C(k+4), so that it shows        the erased value “−.”

As with the incrementing operations described in relation to FIGS. 3 and4 and the initialization operation described in relation to FIG. 5,during the implementation of this initialization operation, the memorycells C(0) to C(N−1) of the monotonic counter pass through differentstable states and unstable states. The succession of these states isdescribed below. Examples of the method for stabilizing these states aredescribed in relation to FIGS. 7 to 9.

During the step of writing the null value “0” in the memory cell C(k+2),the counter passes through a succession of three states (b3), (g1) and(g2) where the value represented by the memory cell C(k+2) isunreliable. In the state (b3), the memory cell C(k+2) still representsthe erased value “−” complementary to the zero value “0.” In the state(g1), the memory cell C(k+2) represents the erroneous value Errdifferent from the value “−” and the null value “0.” In the state (g2),the memory cell C(k+2) already represents the null value “0.”

During the step of erasing the memory cell C(k+3), the counter goesthrough a succession of two states (g3) and (e4) where the valuerepresenting the memory cell C(k+3) is unreliable. In the state (g3),the memory cell C(k+3) still represents any value “#.” In the state(e4), the memory cell C(k+3) is probably already representing thedeleted value “−.”

During the step of writing the null value “0” to the memory cell C(k+1),the counter goes through a succession of three states (e3), (f1) and(f2) where the value represented by the memory cell C(k+1) isunreliable. In the state (e3), the memory cell C(k+1) still representsthe erased value “−” complementary to the null value “0.” In the state(f1), the memory cell C(k+1) represents the erroneous value Errdifferent from the value “−” and the null value “0.” In the state (f2),the memory cell C(k+1) already represents the null value “0.”

During the step of erasing the memory cell C(k+4), the counter passesthrough a succession of two states (f3) and (a1) where the valuerepresented by the memory cell C(k+4) is unreliable. In the state (f3),the memory cell C(k+1) still represents any value “#.” In the state(a1), the memory cell C(k+4) still represents the deleted value “−.”

As with the incrementing operations described in relation to FIGS. 3 and4 and the initialization operation described in relation to FIG. 5, if,after a restart, the counter state is unstable, a stabilization methodallowing to make the state stable is implemented.

The stabilization method implemented for a state of the type of state(b3) is the same as the method for stabilizing states (b1) and (b2)described in relation to FIGS. 3 and 4. In other words, this methodcomprises the following steps:

-   -   confirming the value of the memory cell C(k), by programming the        value it represents;    -   erasing the value of the memory cell C(k+2), so that it        represents the value “−” complementary to the null value “0”;        and    -   writing the null value “0” to the memory cell C(k+3).

The method for stabilizing the states of the type of states (g1), (g2),and (g3) is common to these three states. This method is described inmore detail in relation to FIG. 9.

The method for stabilizing the states of the type of states (f1), (f2),and (f3) is common to these three states. This method is described inmore detail in relation to FIG. 8.

The method for stabilizing states of the type of states (e1), (e2),(e3), and (e4) is common to these four states. This method is describedin more detail in relation to FIG. 10.

The stabilization method implemented for a state of the type of state(a1) comprises erasing the memory cell C(k+4), so that it represents thevalue “−” complementary to the null value “0.”

FIG. 7 shows, very schematically and in block form, a mode ofimplementation of steps of a method for stabilizing a state (E) of themonotonic counter described in relation to FIG. 2. FIG. 7 includes aview (1) showing the state (E) of the counter, and a block diagram (2)representing the implementation of the steps of the method forstabilizing the state (E).

The state (E) of the monotonic counter is an unstable state of themonotonic counter described in relation to FIG. 2 in which two memorycells representing the erased value “−” complementary to the null value“0” are separated by an “inner” memory cell representing any value “#.”According to a variant, the “inner” memory cell can represent the nullvalue “0.” In other words, in state (E) all memory cells C(0) to C(N−1)represent any value “#” except:

-   -   a memory cell C(k+1) which represents the erased value “−”;        and/or    -   a memory cell C(k+3) which represents the erased value “−.”

In state (E), memory cells C(k+1), C(k+2) and C(k+4) may be memory cellsrepresenting an unstable value, and memory cell C(k+3) is a memory cellwith a stable value. The unstable states (e1), (e2), (e3), and (e4)described in relation to FIGS. 5 and 6 can be equated with the state(E), therefore they have a common stabilization method.

The method for stabilizing the state (E) is a method for passing fromthe state (E) to a state of the type of the initial state (A) describedin relation to FIG. 2.

In a step 201 (k+2−>“0”), the memory cell C(k+2) is written so that itsvalue represents the null value “0.”

At a step 202 (k+3−>“−”), the memory cell C(k+3) is erased so that itsvalue represents the erased value “−” complementary to the null value“0.”

In a step 203 (k+1−>“#”), the memory cell C(k+2) is written so that itsvalue represents any value “#.” According to a variant, the memory cellC(k+2) is written so that its value represents the null value “0.”

In a step 204 (k+4−>“−”), the memory cell C(k+4) is erased so that itsvalue represents the erased value “−” complementary to the null value“0.”

After the step 204, the monotonic counter is in the state (A), since allmemory cells C(0) to C(N−1) show any value “#” except the memory cellC(k+2) which represents the null value “0,” and the memory cells C(k+3)and C(k+4) which represent the erased value “−.”

FIG. 8 represents, very schematically and in block form, a mode ofimplementation of the steps of a method for stabilizing a state (F) ofthe monotonic counter described in relation to FIG. 2. FIG. 8 comprisesa view (1) representing the state (F) of the counter, and a blockdiagram (2) representing the implementation of steps of the method forstabilizing the state (F).

The state (F) of the monotonic counter is an unstable state of themonotonic counter described in relation to FIG. 2 in which a stablememory cell representing the null value “0” is preceded by an unstablememory cell representing any value “#” and is followed by a stablememory cell representing the erased value “−.” The memory cellrepresenting the value “−” is followed by an unstable memory cellrepresenting any value “#.” In other words, in the state (F) all thememory cells C(0) to C(N−1) represent any value “#” except:

-   -   the memory cell C(k+1) which represents the null value “0”; and    -   the memory cell C(k+2) which represents the erased value “−”        complementary to the null value “0.”

In the state (F), the memory cells C(k) and C(k+3) may be memory cellsrepresenting an unstable value, and the memory cells C(k+1) and C(k+2)are memory cells with stable values. The unstable states (f1), (f2), and(f3) described in relation to FIG. 5 can be equated to the state (F),which is why they have a common stabilization method.

The method for stabilizing the state (F) is a method for passing fromthe state (F) to a state of the type of the initial state (A) describedin relation to FIG. 2.

At a step 301 (k−>“0”), the memory cell C(k) is written so that itsvalue represents the null value “0.”

At a step 302 (k+3−>“−”), the memory cell C(k+3) is erased so that itsvalue represents the erased value “−” complementary to the null value“0.”

After the step 302, the monotonic counter is in state (A), since allmemory cells C(0) to C(N−1) represent any value “#” except memory cellC(k+1) which represents the null value “0,” and the memory cells C(k+2)and C(k+3) which represent the erased value “−.”

FIG. 9 represents, very schematically and in block form, a mode ofimplementation of steps of a method for stabilizing a state (G) of themonotonic counter described in relation to FIG. 2. FIG. 9 comprises aview (1) representing the state (G) of the counter, and a block diagram(2) representing the implementation of the steps of the method forstabilizing the state (G).

The state (G) of the monotonic counter is an unstable state of themonotonic counter described in relation to FIG. 2 in which a stablememory cell representing any value “#” is followed by four memory cellswhose value is unstable. Specifically, in state (G) all memory cellsC(0) to C(N−1) are stable and represent any value “#” except:

-   -   the memory cell C(k+1) which is unstable and represents the        erased value “−” complementary to the null value “0.”    -   the memory cell C(k+2) which is unstable and which represents        any value “#” different from the null value “0.”    -   the memory cell C(k+3) which is unstable and which represents        any value “#”; and/or    -   memory cell C(k+4) that is unstable and represents any value        “#.”

The unstable states (g1), (g2), and (g3) described in relation to FIG. 6can be equated to the state (G), which is why they have a commonstabilization method.

The method for stabilizing the state (G) is a method which allowspassing from the state (G) to a state of the type of the initial state(A) described in relation to FIG. 2.

In a step 401 (k+2−>“0”), the memory cell C(k+2) is written so that itsvalue represents the null value “0.”

In a step 402 (k+3−>“−”), the memory cell C(k+3) is erased so that itsvalue represents the erased value “−” complementary to the null value“0.”

In a step 403 (k+1−>“#”), the memory cell C(k+2) is written so that itsvalue represents any value “#.” According to a variant, the memory cellC(k+2) is written so that its value represents the null value “0.”

In a step 404 (k+4−>“−”), the memory cell C(k+4) is erased so that itsvalue represents the erased value “−” complementary to the null value“0.”

After step 404, the monotonic counter is in the state (A), since allmemory cells C(0) to C(N−1) represent any value “#” except memory cellC(k+2) which represents the null value “0,” and the memory cells C(k+3)and C(k+4) which represent the erased value “−.”

It should be noted that the state stabilization method (E) described inrelation to FIG. 7 and the state stabilization method (G) described inrelation to FIG. 9 are identical.

FIG. 10 illustrates three states (A′), (B′) and (C′) of anotherembodiment of a monotonic counter.

The monotonic counter described in relation to FIG. 10 is similar to themonotonic counter described in relation to FIGS. 1 to 9. The commonelements of these two counters are not described again here, and onlytheir differences are highlighted. In particular, the notations ofdifferent values that a memory cell can show are kept here.

According to one embodiment, the monotonic counter of FIG. 10 isimplemented using a number N, where N is a natural number greater thanor equal to five of memory cells C′(0) to C′(N−1). The memory cellsC′(0) to C′(N−1) are, for example, memory cells of the non-volatilememory 102 of FIG. 1. Each memory cell C′(0) to C′(N−1) is able to storea binary word, for example an octet In addition, each memory cell C′(0)to C′(N 1) is able to store a binary word whose size is large enough torepresent a maximum value that can be reached by the monotonic counter.According to one example, the memory cells C′(0) to C′(N−1) haveconsecutive memory addresses in memory 102. According to a variant, thememory cells C′(0) to C′(N−1) do not have consecutive memory addressesin the memory 102.

The state (A′) of the monotonic counter is its initial state in whichthe value of the counter is equal to the null value. The state (A′) issimilar to state (A) described in relation to FIG. 2 but differs in thatthe memory cell C′(k) representing the null value “0” is followed by,for i an integer between 2 and N−3, i consecutive memory cellsrepresenting the erased value “−.” In other words, in the state (A′) allthe memory cells C′(0) to C′(N−1) show any value “#” except:

-   -   the memory cell C′(k) which represents the null value “0”; and    -   i memory cells C′(k+1) to C′(k+i) which have been erased and        therefore show the value “−.”

The state (B′) of the monotonic counter is the state in which thecounter value is a value V different from the null value “0” and thevalue “−.” The state (B′) is similar to the state (B) described inrelation to FIG. 2 but differs in that consecutive memory cells C′(k−1)and C′(k) representing, respectively, the value V-2p and the value V arefollowed by i consecutive memory cells C′(k+1) to C′(k+i) representingthe erased value “−.” In other words, in the state (B′) all memory cellsC′(0) to C′(N 1) represent any value “#” except:

-   -   a memory cell C′(k) which represents the value V.    -   a memory cell C′(k−1) which represents the value V subtracted by        two times the step p of the counter; and    -   i memory cells C′(k+1) to C′(k+i) which have been erased and        which therefore represent the value “−.”

The state (C′) of the monotonic counter is the state in which thecounter value is the value V incremented by step p. The state (C′) issimilar to state (C) described in relation to FIG. 2 but differs in thatthe memory cell C′(k) representing the value V is followed by i+1consecutive memory cells representing the erased value “−.” In otherwords, in the state (C′) all memory cells C′(0) to C′(N 1) represent anyvalue “#” except:

-   -   one memory cell C′(k) which represents the value V; and    -   i+1 memory cells C′(k+1) to C′(k+i+1) whose rank is successive        to the memory cell C′(k), which have been erased and which        therefore represent the value “−.”

The two main states of the monotonic counter are the states (B′) and(C′), the state (A′) being the particular case of state (B′) where thevalue V is the null value “0.” A step of incrementing the monotoniccounter allows to pass from the state (B′) to the state (C′), or fromthe state (C′) to the state (B′). Using the incrementing operationsdescribed in relation to FIGS. 3 and 4, it is obvious to the personskilled in the art to implement the incrementing operation from thestate (B′) to state (C′), and the incrementing operation from the state(C′) to state (B′). Similarly, initialization operations of the states(B′) and (C′) and the stabilization methods are obvious to the personskilled in the art from the descriptions in FIGS. 5 to 9.

In particular, an incrementing step allowing to pass from the state (B′)to state (C′) would comprise clearing the memory cell C′(k+i+1), and anincrementing step to pass from the state (C′) to state (B′) wouldcomprise writing the value of the counter incremented by twice the stepp to the memory cell C′(k+1).

Various embodiments and variants have been described. Those skilled inthe art will understand that certain features of these embodiments andvariants “can be combined and other variants will readily occur to thoseskilled in the art.”

Finally, the practical implementation of the embodiments and variantsdescribed herein is within the capabilities of those skilled in the artbased on the functional description provided hereinabove.

One embodiment facilitates addressing all or some of the drawbacks ofknown monotonic counter implementations.

One embodiment provides a monotonic counter whose value is shown by anumber N of binary words stored in N memory cells of a non-volatilememory, each binary word having a size able to represent the maximumvalue of the said counter, and being able to implement a one-stepincrementing operation wherein:

if i first memory cells of consecutive ranks between k modulo N and k+imodulo N, represent a value complementary to the null value, then thevalue of a second cell, of rank k+i+1 modulo N, is erased; and

-   -   if i+1 third memory cells of consecutive ranks between k+1        modulo N and k+i+1 modulo N represent a value complementary to        the null value, then the value incremented by two times the step        of a fourth memory cell of rank k modulo N is written in the        third memory cell of rank k+1 modulo N,    -   with:        -   N being an integer greater than or equal to five.        -   k an integer; and        -   i an integer between 2 and N−3.

Another embodiment provides a method for implementing an incrementingoperation of a monotonic counter, the value of which is represented by anumber N of binary words stored in N memory cells of a non-volatilememory, each binary word having a size able to represent the maximumvalue of the said counter, wherein:

-   -   if i first memory cells of consecutive ranks between k modulo N        and k+i modulo N, represent a value complementary to the null        value, then the value of a second cell, of rank k+i+1 modulo N,        is erased; and    -   if i+1 third memory cells of consecutive ranks between k+1        modulo N and k+i+1 modulo N represent a value complementary to        the null value, then the value incremented by twice the step of        a fourth memory cell of rank k modulo N is written into the        third memory cell of rank k+1 modulo N,        -   with:        -   N being an integer greater than or equal to five.        -   k an integer; and        -   i an integer between 2 and N−3.

According to one embodiment, the value complementary to the null valueis the value taken by a memory cell after its erasure.

According to one embodiment, the memory cells of ranks strictly lowerthan k−1 modulo N and of ranks strictly higher than k+i+1 modulo N allrepresent any value different from the complementary value to the nullvalue.

According to one embodiment, the monotonic counter represents the nullvalue when a fifth memory cell representing the null value is followeddirectly by i sixth memory cells representing the value complementary tothe null value.

According to one embodiment, i is two.

According to one embodiment, if the first two memory cells ofconsecutive ranks between k modulo N and k+i modulo N, represent thecomplementary value to the null value, a first initialization operationcomprises the following steps:

-   -   writing the null value in the memory cell of rank k+2 modulo N.    -   erasing the memory cell of rank k+3 modulo N.    -   writing any value different from the complementary value to the        null value, in the memory cell of rank k+1 modulo N; and    -   erasing the value in the memory cell of rank k+4 modulo N.

According to one embodiment, during the step of writing the memory cellof rank k+1 modulo N, the any value is equal to the null value.

According to one embodiment, if the three third memory cells ofconsecutive ranks between k+1 modulo N and k+3 modulo N represent thevalue complementary to the null value, a second initialization operationcomprises the following steps:

-   -   writing the null value in the memory cell of rank k+2 modulo N.    -   writing any value in the memory cell of rank k+1 modulo N; and    -   erasing the value from the memory cell of rank k+4 modulo N.

According to one embodiment, during the step of writing the memory cellof rank k+1 modulo N, the any value is equal to the null value.

In an embodiment, a device comprises: a non-volatile memory, which, inoperation, stores a number N of binary words in N memory cells of thenon-volatile memory, the N binary words representing a value of amonotonic counter, each binary word having a size sufficient to store amaximum value of the monotonic counter; and control circuitry coupled tothe memory, wherein the control circuitry, in operation, increments thevalue of the monotonic counter by a step size, the incrementing thevalue of the monotonic counter by the step size including: in responseto i memory cells of the N memory cells of consecutive ranks between kmodulo N and k+i modulo N each representing a value complementary to anull value, erasing a value of a memory cell of the N memory cells ofrank k+i+1 modulo N; and in response to i+1 memory cells of the N memorycells of consecutive ranks between k+1 modulo N and k+i+1 modulo N eachrepresenting the value complementary to the null value, incrementing avalue of a memory cell of the N memory cells of rank k modulo N by twostep sizes and storing a result of the incrementing of the value of thememory cell of rank k modulo N by two step sizes in a memory cell of theN memory cells of rank k+1 modulo N, wherein, N is an integer greaterthan or equal to five, k is an integer, and i is an integer between 2and N−3. In an embodiment, the value complementary to the null value isa value of a memory cell of the N memory cells after the memory cell iserased. In an embodiment, the memory cells of ranks lower than k−1modulo N and of ranks higher than k+i+1 modulo N all represent valuesdifferent from the value complementary to the null value. In anembodiment, the monotonic counter represents the null value when amemory cell of the N memory cells representing the null value isfollowed in rank by i memory cells representing the value complementaryto the null value. In an embodiment, i is two. In an embodiment, thecontrol circuitry, in operation, performs an initialization operation,wherein in response to memory cells of the N memory cells of consecutiveranks between k modulo N and k+2 modulo N representing the valuecomplementary to the null value, the initialization operation includes:writing the null value in the memory cell of rank k+2 modulo N; erasingthe memory cell of rank k+3 modulo N; writing any value different fromthe value complementary to the null value, in the memory cell of rankk+1 modulo N; and erasing the memory cell of rank k+4 modulo N. In anembodiment, writing any value different from the value complementary tothe null value, in the memory cell of rank k+1 modulo N, compriseswriting the zero value in the memory cell of rank K+1 modulo N. In anembodiment, in response to memory cells of the N memory cells ofconsecutive ranks between k+1 modulo N and k+3 modulo N represent thevalue complementary to the null value, the initialization operationincludes: writing the null value in the memory cell of rank k+2 moduloN; writing any value different from the value complementary to the nullvalue in the memory cell of rank k+1 modulo N; and erasing the value ofthe memory cell of rank k+4 modulo N. In an embodiment, writing anyvalue different from the value complementary to the null value, in thememory cell of rank k+1 modulo N, comprises writing the zero value inthe memory cell of rank K+1 modulo N.

In an embodiment, a method, comprises: storing a number N of binarywords in N memory cells of a non-volatile memory, the N binary wordsrepresenting a value of a monotonic counter, each binary word having asize sufficient to store a maximum value of the monotonic counter; andincrementing the value of the monotonic counter by a step size. Theincrementing the value of the monotonic counter by the step sizeincludes: in response to i memory cells of the N memory cells ofconsecutive ranks between k modulo N and k+i modulo N each representinga value complementary to a null value, erasing a value of a memory cellof the N memory cells of rank k+i+1 modulo N; and in response to i+1memory cells of the N memory cells of consecutive ranks between k+1modulo N and k+i+1 modulo N each representing the value complementary tothe null value, incrementing a value of a memory cell of the N memorycells of rank k modulo N by two step sizes and storing a result of theincrementing of the value of the memory cell of rank k modulo N by twostep sizes in a memory cell of the N memory cells of rank k+1 modulo N,wherein, N is an integer greater than or equal to five, k is an integer,and i is an integer between 2 and N−3. In an embodiment, the valuecomplementary to the null value is a value of a memory cell of the Nmemory cells after the memory cell is erased. In an embodiment, thememory cells of ranks lower than k−1 modulo N and of ranks higher thank+i+1 modulo N all represent values different from the valuecomplementary to the null value. In an embodiment, the monotonic counterrepresents the null value when a memory cell of the N memory cellsrepresenting the null value is followed in rank by i memory cellsrepresenting the value complementary to the null value. In anembodiment, i is two. In an embodiment, the method comprises performingan initialization operation, wherein in response to memory cells of theN memory cells of consecutive ranks between k modulo N and k+2 modulo Nrepresenting the value complementary to the null value, theinitialization operation includes: writing the null value in the memorycell of rank k+2 modulo N; erasing the memory cell of rank k+3 modulo N;writing any value different from the value complementary to the nullvalue, in the memory cell of rank k+1 modulo N; and erasing the memorycell of rank k+4 modulo N. In an embodiment, writing any value differentfrom the value complementary to the null value, in the memory cell ofrank k+1 modulo N, comprises writing the zero value in the memory cellof rank K+1 modulo N. In an embodiment, in response to memory cells ofthe N memory cells of consecutive ranks between k+1 modulo N and k+3modulo N represent the value complementary to the null value, theinitialization operation includes: writing the null value in the memorycell of rank k+2 modulo N; writing any value different from the valuecomplementary to the null value in the memory cell of rank k+1 modulo N;and erasing the value of the memory cell of rank k+4 modulo N.

In an embodiment, a system comprises: a processor, which, in operation,processes data; and a monotonic counter coupled to the processor,wherein the monotonic counter, in operation: stores a number N of binarywords in N memory cells of a non-volatile memory, the N binary wordsrepresenting a value of a monotonic counter, each binary word having asize sufficient to store a maximum value of the monotonic counter; andresponds to an indication to increment the value of the monotoniccounter by a step size by: in response to i memory cells of the N memorycells of consecutive ranks between k modulo N and k+i modulo N eachrepresenting a value complementary to a null value, erasing a value of amemory cell of the N memory cells of rank k+i+1 modulo N; and inresponse to i+1 memory cells of the N memory cells of consecutive ranksbetween k+1 modulo N and k+i+1 modulo N each representing the valuecomplementary to the null value, incrementing a value of a memory cellof the N memory cells of rank k modulo N by two step sizes and storing aresult of the incrementing of the value of the memory cell of rank kmodulo N by two step sizes in a memory cell of the N memory cells ofrank k+1 modulo N, wherein, N is an integer greater than or equal tofive, k is an integer, and i is an integer between 2 and N−3. In anembodiment, the system comprises: functional circuitry coupled to theprocessor and to the monotonic counter, wherein the functionalcircuitry, in operation, retrieves the value stored in the monotoniccounter. In an embodiment, the system comprises an integrated circuitincluding the processor and the monotonic counter.

In an embodiment, a non-transitory computer-readable medium's contentscause a monotonic counter to perform a method, the method comprising:storing a number N of binary words in N memory cells of a non-volatilememory, the N binary words representing a value of the monotoniccounter, each binary word having a size sufficient to store a maximumvalue of the monotonic counter; and incrementing the value of themonotonic counter by a step size, the incrementing the value of themonotonic counter by the step size including: in response to i memorycells of the N memory cells of consecutive ranks between k modulo N andk+i modulo N each representing a value complementary to a null value,erasing a value of a memory cell of the N memory cells of rank k+i+1modulo N; and in response to i+1 memory cells of the N memory cells ofconsecutive ranks between k+1 modulo N and k+i+1 modulo N eachrepresenting the value complementary to the null value, incrementing avalue of a memory cell of the N memory cells of rank k modulo N by twostep sizes and storing a result of the incrementing of the value of thememory cell of rank k modulo N by two step sizes in a memory cell of theN memory cells of rank k+1 modulo N, wherein, N is an integer greaterthan or equal to five, k is an integer, and i is an integer between 2and N−3. In an embodiment, the value complementary to the null value isa value of a memory cell of the N memory cells after the memory cell iserased. In an embodiment, i is two. In an embodiment, the methodcomprises performing an initialization operation. In an embodiment, thecontents comprise instruction executed by processing circuitry of themonotonic counter.

Some embodiments may take the form of or comprise computer programproducts. For example, according to one embodiment there is provided acomputer readable medium comprising a computer program adapted toperform one or more of the methods or functions described above. Themedium may be a physical storage medium, such as for example a Read OnlyMemory (ROM) chip, or a disk such as a Digital Versatile Disk (DVD-ROM),Compact Disk (CD-ROM), a hard disk, a memory, a network, or a portablemedia article to be read by an appropriate drive or via an appropriateconnection, including as encoded in one or more barcodes or otherrelated codes stored on one or more such computer-readable mediums andbeing readable by an appropriate reader device.

Furthermore, in some embodiments, some or all of the methods and/orfunctionality may be implemented or provided in other manners, such asat least partially in firmware and/or hardware, including, but notlimited to, one or more application-specific integrated circuits(ASICs), digital signal processors, discrete circuitry, logic gates,standard integrated circuits, controllers (e.g., by executingappropriate instructions, and including microcontrollers and/or embeddedcontrollers), field-programmable gate arrays (FPGAs), complexprogrammable logic devices (CPLDs), etc., as well as devices that employRFID technology, and various combinations thereof. The variousembodiments described above can be combined to provide furtherembodiments. Aspects of the embodiments can be modified, if necessary toemploy concepts of the various patents, applications and publications toprovide yet further embodiments.

These and other changes can be made to the embodiments in light of theabove-detailed description. In general, in the following claims, theterms used should not be construed to limit the claims to the specificembodiments disclosed in the specification and the claims, but should beconstrued to include all possible embodiments along with the full scopeof equivalents to which such claims are entitled. Accordingly, theclaims are not limited by the disclosure.

1. A device comprising: a non-volatile memory, which, in operation,stores a number N of binary words in N memory cells of the non-volatilememory, the N binary words representing a value of a monotonic counter,each binary word having a size sufficient to store a maximum value ofthe monotonic counter; and control circuitry coupled to the memory,wherein the control circuitry, in operation, increments the value of themonotonic counter by a step size, the incrementing the value of themonotonic counter by the step size including: in response to i memorycells of the N memory cells of consecutive ranks between k modulo N andk+i modulo N each representing a value complementary to a null value,erasing a value of a memory cell of the N memory cells of rank k+i+1modulo N; and in response to i+1 memory cells of the N memory cells ofconsecutive ranks between k+1 modulo N and k+i+1 modulo N eachrepresenting the value complementary to the null value, incrementing avalue of a memory cell of the N memory cells of rank k modulo N by twostep sizes and storing a result of the incrementing of the value of thememory cell of rank k modulo N by two step sizes in a memory cell of theN memory cells of rank k+1 modulo N, wherein, N is an integer greaterthan or equal to five, k is an integer, and i is an integer between 2and N−3.
 2. The device of claim 1, wherein the value complementary tothe null value is a value of a memory cell of the N memory cells afterthe memory cell is erased.
 3. The device of claim 1, wherein the memorycells of ranks lower than k−1 modulo N and of ranks higher than k+i+1modulo N all represent values different from the value complementary tothe null value.
 4. The device of claim 1, wherein the monotonic counterrepresents the null value when a memory cell of the N memory cellsrepresenting the null value is followed in rank by i memory cellsrepresenting the value complementary to the null value.
 5. The device ofclaim 1, wherein i is two.
 6. The device of claim 5, wherein the controlcircuitry, in operation, performs an initialization operation, whereinin response to memory cells of the N memory cells of consecutive ranksbetween k modulo N and k+2 modulo N representing the value complementaryto the null value, the initialization operation includes: writing thenull value in the memory cell of rank k+2 modulo N; erasing the memorycell of rank k+3 modulo N; writing any value different from the valuecomplementary to the null value, in the memory cell of rank k+1 moduloN; and erasing the memory cell of rank k+4 modulo N.
 7. The device ofclaim 6, herein the writing any value different from the valuecomplementary to the null value, in the memory cell of rank k+1 moduloN, comprises writing the zero value in the memory cell of rank K+1modulo N.
 8. The device of claim 6, wherein in response to memory cellsof the N memory cells of consecutive ranks between k+1 modulo N and k+3modulo N represent the value complementary to the null value, theinitialization operation includes: writing the null value in the memorycell of rank k+2 modulo N; writing any value different from the valuecomplementary to the null value in the memory cell of rank k+1 modulo N;and erasing the value of the memory cell of rank k+4 modulo N.
 9. Thedevice according to claim 8, wherein the writing any value differentfrom the value complementary to the null value, in the memory cell ofrank k+1 modulo N, comprises writing the zero value in the memory cellof rank K+1 modulo N.
 10. A method, comprising: storing a number N ofbinary words in N memory cells of a non-volatile memory, the N binarywords representing a value of a monotonic counter, each binary wordhaving a size sufficient to store a maximum value of the monotoniccounter; and incrementing the value of the monotonic counter by a stepsize, the incrementing the value of the monotonic counter by the stepsize including: in response to i memory cells of the N memory cells ofconsecutive ranks between k modulo N and k+i modulo N each representinga value complementary to a null value, erasing a value of a memory cellof the N memory cells of rank k+i+1 modulo N; and in response to i+1memory cells of the N memory cells of consecutive ranks between k+1modulo N and k+i+1 modulo N each representing the value complementary tothe null value, incrementing a value of a memory cell of the N memorycells of rank k modulo N by two step sizes and storing a result of theincrementing of the value of the memory cell of rank k modulo N by twostep sizes in a memory cell of the N memory cells of rank k+1 modulo N,wherein, N is an integer greater than or equal to five, k is an integer,and i is an integer between 2 and N−3.
 11. The method of claim 10,wherein the value complementary to the null value is a value of a memorycell of the N memory cells after the memory cell is erased.
 12. Themethod of claim 10, wherein the memory cells of ranks lower than k−1modulo N and of ranks higher than k+i+1 modulo N all represent valuesdifferent from the value complementary to the null value.
 13. The methodof claim 10, wherein the monotonic counter represents the null valuewhen a memory cell of the N memory cells representing the null value isfollowed in rank by i memory cells representing the value complementaryto the null value.
 14. The method of claim 10, wherein i is two.
 15. Themethod of claim 14, comprising performing an initialization operation,wherein in response to memory cells of the N memory cells of consecutiveranks between k modulo N and k+2 modulo N representing the valuecomplementary to the null value, the initialization operation includes:writing the null value in the memory cell of rank k+2 modulo N; erasingthe memory cell of rank k+3 modulo N; writing any value different fromthe value complementary to the null value, in the memory cell of rankk+1 modulo N; and erasing the memory cell of rank k+4 modulo N.
 16. Themethod of claim 15, wherein the writing any value different from thevalue complementary to the null value, in the memory cell of rank k+1modulo N, comprises writing the zero value in the memory cell of rankK+1 modulo N.
 17. The method of claim 15, wherein in response to memorycells of the N memory cells of consecutive ranks between k+1 modulo Nand k+3 modulo N represent the value complementary to the null value,the initialization operation includes: writing the null value in thememory cell of rank k+2 modulo N; writing any value different from thevalue complementary to the null value in the memory cell of rank k+1modulo N; and erasing the value of the memory cell of rank k+4 modulo N.18. A system, comprising: a processor, which, in operation, processesdata; and a monotonic counter coupled to the processor, wherein themonotonic counter, in operation: stores a number N of binary words in Nmemory cells of a non-volatile memory, the N binary words representing avalue of a monotonic counter, each binary word having a size sufficientto store a maximum value of the monotonic counter; and responds to anindication to increment the value of the monotonic counter by a stepsize by: in response to i memory cells of the N memory cells ofconsecutive ranks between k modulo N and k+i modulo N each representinga value complementary to a null value, erasing a value of a memory cellof the N memory cells of rank k+i+1 modulo N; and in response to i+1memory cells of the N memory cells of consecutive ranks between k+1modulo N and k+i+1 modulo N each representing the value complementary tothe null value, incrementing a value of a memory cell of the N memorycells of rank k modulo N by two step sizes and storing a result of theincrementing of the value of the memory cell of rank k modulo N by twostep sizes in a memory cell of the N memory cells of rank k+1 modulo N,wherein, N is an integer greater than or equal to five, k is an integer,and i is an integer between 2 and N−3.
 19. The system of claim 18,comprising: functional circuitry coupled to the processor and to themonotonic counter, wherein the functional circuitry, in operation,retrieves the value stored in the monotonic counter.
 20. The system ofclaim 18, comprising an integrated circuit including the processor andthe monotonic counter.
 21. A non-transitory computer-readable mediumhaving contents which cause a monotonic counter to perform a method, themethod comprising: storing a number N of binary words in N memory cellsof a non-volatile memory, the N binary words representing a value of themonotonic counter, each binary word having a size sufficient to store amaximum value of the monotonic counter; and incrementing the value ofthe monotonic counter by a step size, the incrementing the value of themonotonic counter by the step size including: in response to i memorycells of the N memory cells of consecutive ranks between k modulo N andk+i modulo N each representing a value complementary to a null value,erasing a value of a memory cell of the N memory cells of rank k+i+1modulo N; and in response to i+1 memory cells of the N memory cells ofconsecutive ranks between k+1 modulo N and k+i+1 modulo N eachrepresenting the value complementary to the null value, incrementing avalue of a memory cell of the N memory cells of rank k modulo N by twostep sizes and storing a result of the incrementing of the value of thememory cell of rank k modulo N by two step sizes in a memory cell of theN memory cells of rank k+1 modulo N, wherein, N is an integer greaterthan or equal to five, k is an integer, and i is an integer between 2and N−3.
 22. The non-transitory computer-readable medium of claim 21,wherein the value complementary to the null value is a value of a memorycell of the N memory cells after the memory cell is erased.
 23. Thenon-transitory computer-readable medium of claim 21, wherein i is two.24. The non-transitory computer-readable medium of claim 21, the methodcomprising performing an initialization operation.
 25. Thenon-transitory computer-readable medium of claim 21, wherein thecontents comprise instruction executed by processing circuitry of themonotonic counter.